package com.qd.hik.dto;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * 〈一句话功能简述〉<br>
 *
 * @author sjk
 * @create 2024-05-27 11:03
 * @since 1.0.0
 */
@Data
@Accessors(chain = true)
public class HkBaseHttpResp<T> {
    public static final String SUCCESS = "200";
    /**
     * 编码
     */
    private String code;
    /**
     * 错误信息
     */
    private String msg;
    /**
     * 数据
     */
    private T data;
    /**
     * 请求json
     */
    @JsonIgnore
    private String reqJson;
    /**
     * 请求地址
     */
    @JsonIgnore
    private String reqUrl;

    @JsonIgnore
    public boolean isSuccess() {
        return SUCCESS.equals(code);
    }

    public void freeData() {
        this.code = null;
        this.msg = null;
        this.data = null;
        this.reqJson = null;
        this.reqUrl = null;
    }
}